From 0bf68f1372cfd5b5076f752713e8cda886a7cbec Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 25 Oct 2023 21:39:52 -0400 Subject: [PATCH] Fix swizzle values for some memory formats For opaque formats with 3 channels, we should use the default GL_ALPHA, but for opaque formats with an ignored 4th channel, we must use GL_ONE. --- gdk/gdkmemoryformat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdk/gdkmemoryformat.c b/gdk/gdkmemoryformat.c index 3b21734c14..61ef3a5a42 100644 --- a/gdk/gdkmemoryformat.c +++ b/gdk/gdkmemoryformat.c @@ -423,7 +423,7 @@ static const GdkMemoryFormatDescription memory_formats[] = { G_ALIGNOF (guchar), GDK_MEMORY_U8, { 0, 0, 0, 0 }, - { GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } }, + { GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } }, r8g8b8_to_float, r8g8b8_from_float, }, @@ -433,7 +433,7 @@ static const GdkMemoryFormatDescription memory_formats[] = { G_ALIGNOF (guchar), GDK_MEMORY_U8, { 0, 0, G_MAXUINT, G_MAXUINT }, - { GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } }, + { GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } }, b8g8r8_to_float, b8g8r8_from_float, }, @@ -443,7 +443,7 @@ static const GdkMemoryFormatDescription memory_formats[] = { G_ALIGNOF (guint16), GDK_MEMORY_U16, { 0, 0, 3, 0 }, - { GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } }, + { GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } }, r16g16b16_to_float, r16g16b16_from_float, }, @@ -473,7 +473,7 @@ static const GdkMemoryFormatDescription memory_formats[] = { G_ALIGNOF (guint16), GDK_MEMORY_FLOAT16, { 0, 0, 3, 0 }, - { GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } }, + { GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } }, r16g16b16_float_to_float, r16g16b16_float_from_float, }, @@ -503,7 +503,7 @@ static const GdkMemoryFormatDescription memory_formats[] = { G_ALIGNOF (float), GDK_MEMORY_FLOAT32, { 0, 0, 3, 0 }, - { GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } }, + { GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } }, r32g32b32_float_to_float, r32g32b32_float_from_float, }, -- 2.30.2